<?php

namespace App\Console\Commands;

use App\Library\OSS;
use App\Modules\Order\Jobs\AddSpecJob;
use App\Modules\Order\Models\Order;
use App\Modules\Order\Models\SupportOrder;
use App\Modules\Package\Models\PackageAttrValue;
use App\Modules\Payment\Models\WeChatPay;
use App\Modules\Payment\Models\WeChatRefund;
use App\Modules\Package\Models\GoodPackage;
use App\Modules\Shop\Schedule;
use App\Modules\Shop\Shop;
use App\Modules\User\Manager;
use App\Modules\User\Models\Admin;
use App\Modules\User\Models\User;
use App\Modules\Withdrawal\Models\Withdrawal;
use Endroid\QrCode\ErrorCorrectionLevel;
use Endroid\QrCode\QrCode;
use GuzzleHttp\Client;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Redis;
use Ramsey\Uuid\Uuid;
use Overtrue\LaravelWeChat\Facade as EasyWeChat;
use Tymon\JWTAuth\Facades\JWTAuth;
use Silber\Bouncer\BouncerFacade;

class wqb extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'wqb';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $miniProgram = EasyWeChat::miniProgram();
        $response = $miniProgram->app_code->getUnlimit("id=1#pkg_id=12", [
            'page'  => "pages/pkg_detail/main",
            'width' => 136,
        ]);
        var_dump($response);
        exit;
        PackageAttrValue::query()
            ->orderBy('id', 'asc')
            ->each(function ($item) {
                dispatch(new AddSpecJob($item));
            });
        exit;
        $order = Order::query()->where('id', 13)->first();
        $order->active(0);
        exit;
        $admin = Admin::query()->find(1);
        BouncerFacade::assign('superadmin')->to($admin);
        exit;
    }
}
